package com.mbiolance.cloud.activiti.rpc;

import com.mbiolance.cloud.activiti.domain.dto.ActivitiFormDto;
import com.mbiolance.cloud.activiti.domain.dto.ProcessTaskDto;
import com.mbiolance.cloud.auth.domain.PageModel;
import com.mbiolance.cloud.auth.domain.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "ProcessTask", value = "mbiolance-service-activiti", path = "/process-task"
        , configuration = FeignConfiguration.class)
public interface ProcessTaskFeignService {

    @ApiOperation("获取角色流程待办任务的分页列表")
    @GetMapping("role-todo")
    R<PageModel<ProcessTaskDto>> roleTodo(@RequestParam(required = false, defaultValue = "1") Integer number
            , @RequestParam(required = false, defaultValue = "10") Integer size);

    @ApiOperation("获取流程待办任务的分页列表")
    @GetMapping("todo")
    R<PageModel<ProcessTaskDto>> todo(@RequestParam(required = false, defaultValue = "1") Integer number
            , @RequestParam(required = false, defaultValue = "10") Integer size);


    @ApiOperation("获取流程已办任务的分页列表")
    @GetMapping("done")
    R<PageModel<ProcessTaskDto>> done(@RequestParam(required = false, defaultValue = "1") Integer number
            , @RequestParam(required = false, defaultValue = "10") Integer size);

    @ApiOperation("完成任务")
    @PostMapping("complete-task/{taskId}")
    R<Void> completeTask(@PathVariable String taskId, @RequestBody(required = false) Map<String, Object> variables);

    @ApiOperation("获取任务上的自定义表单")
    @GetMapping("form/{taskId}")
    R<ActivitiFormDto> getForm(@PathVariable String taskId);

    @ApiOperation("任务拾取")
    @PostMapping("claim/{id}")
    R<Boolean> claim(@PathVariable String id);

    @ApiOperation("任务退回")
    @PostMapping("ret-task/{id}")
    R<Boolean> retTask(@PathVariable String id);

}
